/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.gov.ana.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author lucas.nunes
 */
@Entity
@Table(name = "QLTTB_JURISDICAO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Jurisdicao.findAll", query = "SELECT j FROM Jurisdicao j"),
    @NamedQuery(name = "Jurisdicao.findByJurId", query = "SELECT j FROM Jurisdicao j WHERE j.jurId = :jurId"),
    @NamedQuery(name = "Jurisdicao.findByJurNm", query = "SELECT j FROM Jurisdicao j WHERE j.jurNm = :jurNm"),
    @NamedQuery(name = "Jurisdicao.findByJurDs", query = "SELECT j FROM Jurisdicao j WHERE j.jurDs = :jurDs")})
@SequenceGenerator(name = "sequenceJurisdicao", sequenceName = "SQ_QLTTB_JURISDICAO", allocationSize = 1)
public class Jurisdicao implements Serializable {

    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "JUR_ID")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceJurisdicao")
    private BigDecimal jurId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "JUR_NM")
    private String jurNm;
    @Size(max = 4000)
    @Column(name = "JUR_DS")
    private String jurDs;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "orgJurId")
    private List<Orgao> orgaoList;

    /**
     *
     */
    public Jurisdicao() {
    }

    /**
     *
     * @param jurId
     */
    public Jurisdicao(BigDecimal jurId) {
        this.jurId = jurId;
    }

    /**
     *
     * @param jurId
     * @param jurNm
     */
    public Jurisdicao(BigDecimal jurId, String jurNm) {
        this.jurId = jurId;
        this.jurNm = jurNm;
    }

    /**
     *
     * @return
     */
    public BigDecimal getJurId() {
        return jurId;
    }

    /**
     *
     * @param jurId
     */
    public void setJurId(BigDecimal jurId) {
        this.jurId = jurId;
    }

    /**
     *
     * @return
     */
    public String getJurNm() {
        return jurNm;
    }

    /**
     *
     * @param jurNm
     */
    public void setJurNm(String jurNm) {
        this.jurNm = jurNm;
    }

    /**
     *
     * @return
     */
    public String getJurDs() {
        return jurDs;
    }

    /**
     *
     * @param jurDs
     */
    public void setJurDs(String jurDs) {
        this.jurDs = jurDs;
    }

    /**
     *
     * @return
     */
    @XmlTransient
    public List<Orgao> getOrgaoList() {
        return orgaoList;
    }

    /**
     *
     * @param orgaoList
     */
    public void setOrgaoList(List<Orgao> orgaoList) {
        this.orgaoList = orgaoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (jurId != null ? jurId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Jurisdicao)) {
            return false;
        }
        Jurisdicao other = (Jurisdicao) object;
        if ((this.jurId == null && other.jurId != null) || (this.jurId != null && !this.jurId.equals(other.jurId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return this.jurNm;
    }
}
